import {encodeSearchParams} from "@/common/utils/utils.js";

const PREFIX = '/admin/order'
import request from '@/request/request.js'

/**
 * 获取订单列表
 * @returns {*}
 */
export const getOrderList = (searchData) => request(`${PREFIX}?${encodeSearchParams(searchData)}`)

/**
 * 添加订单
 * @param data 表单数据
 * @returns {*}
 */
export const addOrder = (data) => request(`${PREFIX}`, data, 'post')

/**
 * 获取订单
 * @returns {*}
 * @param id
 */
export const getOrderById = (id) => request(`${PREFIX}/${id}`)

/**
 * 修改订单
 * @param data 表单数据
 * @returns {*}
 */
export const updateOrder = (data) => request(`${PREFIX}`, data, 'put')

/**
 * 删除订单
 * @returns {*}
 * @param id
 */
export const deleteOrder = (id) => request(`${PREFIX}/${id}`, null, 'delete')

export const shipmentsOrder = (id, logisticsNo) => request(`${PREFIX}`, {id:id, logisticsNo:logisticsNo}, 'put')
